<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="cn.itcast.domain.Student" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查看学生</title>
</head>
<%
    ArrayList<Student> list = new ArrayList<>();
    list.add(new Student("x","22","99"));
    list.add(new Student("xx","25","93"));
    list.add(new Student("xxx","27","89"));
    pageContext.setAttribute("student",list);
%>
<body>
    <table width="170px" border="1px" style=" border: lightskyblue ;margin: 0 auto">
        <c:if test="${not empty student}">
        <tr>
            <th>编号</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>成绩</th>
        </tr>
        <c:forEach items="${student}" begin="0" end="${student.size()-1}" var="student" step="1" varStatus="number">
            <tr>
                <td>${number.count}</td>
                <td>${student.name}</td>
                <td>${student.age}</td>
                <td>${student.score}</td>
            </tr>
        </c:forEach>
        </c:if>
    </table>
    <a href="${pageContext.request.contextPath}/index.jsp">返回</a>
</body>
</html>
